enum ShapeDrawMode {SDM_STATIC=0, SDM_DYNAMIC=1};

class Shape
{
	class Vertex
	{
	public:
		float u,v;
		unsigned char r,g,b,a;
		float x,y,z;
	};

	GLuint IB;
	GLuint VB;

	GLuint primtype;
	ShapeDrawMode dm;
	void init();

	Vertex *vertices;
	unsigned short int *indices;

	int cv;
	int ci;

	void MakeVBO();
public:
	Shape();
	Shape(int ci,int cv);
	Shape(const char* filename);

	~Shape();

	void DrawMode(ShapeDrawMode dm);
	void resize(int ci,int cv);

	void SetIndex(int i,int index);
	void SetVertexPos(int i,float x,float y);
	void SetVertexUV(int i,float u,float v);
	void SetVertexColor(int i,unsigned char r,unsigned char g,unsigned char b,unsigned char a);

	void Draw(float x, float y);
	void Draw();

	void Color(unsigned char r,unsigned char g,unsigned char b,unsigned char a);
	void SetPrimType(unsigned int pt);

	void Load(const char *filename);
	void Save(const char *filename);
};